# encoding: utf-8

require 'bundler/setup'
require 'ant'
require 'rubydoop/package'


task :build do
  mkdir_p 'ext/build'
  mkdir_p 'ext/dist'

  ant do
    javac destdir: 'ext/build', includeantruntime: 'no' do
      src { pathelement :location => 'ext/src' }
    end

    jar destfile: 'ext/dist/test_project_ext.jar', basedir: 'ext/build' do
      fileset dir: 'ext/build', includes: '**/*.class'
    end
  end
end

task :package => :build do
  job_package = Rubydoop::Package.new(lib_jars: Dir['ext/dist/*.jar'])
  job_package.create!
end

task :clean do
  rm_rf 'ext/build'
  rm_rf 'build'
  rm_rf 'data/output'
  rm_rf 'data/log'
  rm_rf 'lib/test_project_ext.jar'
end